import { combineReducers } from 'redux'
import { handleActions } from 'redux-actions'
const initState = {
    name: '李四'
};
// const addName = (state = initState, action) => {
//     const {
//         type,
//         payload
//     } = action;
//     switch (type) {
//         case 'addName':
//             return {
//                 ...state,
//                 name: payload.name,
//             }
//         default:
//             return state
//     }
// }
const addName = handleActions({
    'addName': (state, action) => {
        return {
            ...state,
            name: action.payload.name,
        }
    }
}, initState)

export default combineReducers({
    addNameReducer: addName,

})